package com.adjy.pathbuilders.rendering;

import java.util.HashMap;

public class AnimationPack {
	
	HashMap<String, Animation> animations;
	
	public AnimationPack(HashMap<String, Animation> animations) {
		this.animations = animations;
	}
	
	public Animation getAnimation(String id) { // TODO: Check if exists.. blablabla
		Animation result = animations.get(id);
		if(result == null) new Exception(id + " is not valid").printStackTrace();
		return result;
	}
	
	public void release() {
		for (String key : animations.keySet())
			animations.get(key).release();
		animations.clear();
	}

	public AnimationPack copy() {
		HashMap<String, Animation> animations = new HashMap<String, Animation>();
		
		for (String animationKey : this.animations.keySet()) {
			animations.put(animationKey, this.animations.get(animationKey).copy());
		}
		
		return new AnimationPack(animations);
	}

}
